﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccessClasses;

namespace TicketsOnline
{
    public partial class Categories : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DataAccessLayer dal = new DataAccessLayer();
            RepeaterCategories.DataSource = dal.Categories;
            RepeaterCategories.DataBind();

            int? categoryId = null;
            int categoryIdNn;
            if (Request.QueryString["category"] != null && int.TryParse(Request.QueryString["category"], out categoryIdNn))
            {
                categoryId = categoryIdNn;
            }
                 
            ListViewTickets.DataSource = dal.FindUpcomingEvents(categoryId);
            ListViewTickets.DataBind();
        }
    }
}